﻿@using CoralNode.MvcClient.Helper
@using Coralcode.Base.Entity
@model CoralNode.Core.Entity.SearchQuerys.Node.NodeSearchQuery 

@{
    Layout = null;
   
}
<!doctype html>
<html>
<head>
    <meta charset="utf-8">
    <link rel="stylesheet" type="text/css" href="/Themes/CoralAdmin/_misc/css/screen.css">
    <link rel="stylesheet" type="text/css" href="/Themes/CoralAdmin/_misc/css/main.css">
        <link rel="stylesheet" type="text/css" href="/Themes/CoralAdmin/_misc/scripts/jqueryUI/css/jquery-ui-timepicker-addon.css">
    <script src="/Themes/CoralAdmin/_misc/scripts/jquery-1.7.2.min.js"></script>
    <script src="/Themes/CoralAdmin/_misc/scripts/jqueryUI/jquery-ui-1.10.3.custom.min.js"></script>
    <script src="/Themes/CoralAdmin/_misc/scripts/jqueryUI/jquery-ui-timepicker-addon.js"></script>
    <style>
        html { width: 100%; height: auto; }
        body { width: 100%; height: auto; }
    </style>
</head>
<body>
    <div>
        <div class="tablelist_style1" data-js="tabellist_style1">
            <form method="POST" class="js-search" action="/m/node/NodeRelation/@ViewContext.RouteData.Values["Id"]">
                <div class="funsearch p_1 pl_2 pr_2 extra_normal">
                    <div class="form_main">
                        <label class="pt_0-5">原型：</label>
                        <label>
                            <select name="prototypeId" class="w_10">
                                <option value="0">全部</option>
                                @foreach (var item in ViewBag.PrototypeList)
                                {
                                    if (item.Id == Model.PrototypeId)
                                    {
                                    <option selected="selected" value="@item.Id">@item.Title</option>
                                    }
                                    else
                                    {
                                    <option value="@item.Id">@item.Title</option>
                                    }

                                }
                            </select>
                        </label>
                        <label class="pt_0-5 pl_2">分类：</label>
                        <label>
                            <select name="categoryId" class="w_10">
                                <option value="0">全部</option>
                                @foreach (var item in ViewBag.CategoryList)
                                {
                                    if (item.Id == Model.CategoryId)
                                    {
                                    <option selected="selected" value="@item.Id">@item.Title</option>
                                    }
                                    else
                                    {
                                    <option value="@item.Id">@item.Title</option>
                                    }
                                }
                            </select>
                        </label>
                    </div>
                    <div class="f_r">

                        <span class="t_des f_l pt_0-5">内容名称：</span>
                        <label class="search f_l">
                            @Html.TextBoxFor(m => m.Title, new { @class = "text w_18", @msg = "请输入关键字" })
                            @Html.AntiForgeryToken()
                            <input type="submit" value="" class="submit" /></label>

                    </div>
                </div>
            </form>
            <table cellpadding="0" cellspacing="0">
                <tr class="exclude">
                    <th width="60">选择</th>
                    <th width="50" align="left">ID</th>
                    <th align="left">名称</th>
                    <th width="140">操作</th>
                </tr>
                @if (@ViewBag.NodeList != null)
                {
                    foreach (var item in @ViewBag.NodeList.Items)
                    {
                    <tr>
                        <td>
                            <label class="checkbox_own">
                                <input type="checkbox" value="@item.Id"/></label></td>
                        <td class="td_left">@item.Id</td>
                        <td class="td_left"><a target="_blank" href="/m/node/editNode/@item.Id">@item.Title</a>
                        </td>
                        <td>
                            <div class="fun">
                                <a itemid="@item.Id" class="js-addrel" href="/m/node/addRelation">添加关联</a>
                            </div>
                        </td>
                    </tr>
                    }
                }
            </table>
            <div class="global_fun ">
                <label class="checkbox_own gloabal_select">
                    <input type="checkbox" /></label>
                <input type="button" class="btn_4 btn invert" value="反选" /><input type="button" class="btn_4 btn reset"
                    value="重置" />
                <a href="/m/node/BatchAddRelation" class="js_batchAdd">添加关联</a>
            </div>
        </div>

    </div>
    @if (@ViewBag.NodeList != null)
    {
        <div id="pager">
            <div class="info_pg">共@(ViewBag.NodeList.TotalItems)条</div>
            <div class="list_pg">

                <a href="/m/node/nodeRelation/@ViewContext.RouteData.Values["Id"]?@ViewBag.queryString&p=1" class="first">
                    首页</a>
                @if (@ViewBag.NodeList.HasPreviousPage && @ViewBag.NodeList.TotalItems > 0)
                {
                    <a href="/m/node/nodeRelation/@ViewContext.RouteData.Values["Id"]?@ViewBag.queryString&p=@ViewBag.NodeList.PreviousPageIndex" class="prev">
                        上一页</a>
                }
                else
                {
                    <a class="prev none">上一页</a>
                }
                @foreach (var i in @ViewBag.NodeList.PageArray)
                {
                    if (@i == @ViewBag.NodeList.CurrentPageIndex)
                    {
                    <a class="current">@i</a>
                    }
                    else if (@i == '0')
                    {
                    <a class="more">…</a>
                    }
                    else
                    {
                    <a href="/m/node/nodeRelation/@ViewContext.RouteData.Values["Id"]?@ViewBag.queryString&p=@i" href="#">@i</a>
                    }
                }
                @if (@ViewBag.NodeList.HasNextPage && @ViewBag.NodeList.TotalItems > 0)
                {
                    <a class="next" href="/m/node/nodeRelation/@ViewContext.RouteData.Values["Id"]?@ViewBag.queryString&p=@ViewBag.NodeList.NextPageIndex">
                        下一页</a>
                }
                else
                {
                    <a class="next none">下一页</a>
                }
                <a class="last" href="/m/node/nodeRelation/@ViewContext.RouteData.Values["Id"]?@ViewBag.queryString&p=@ViewBag.NodeList.TotalPages">
                    尾页</a>
                <!-- <span class="msg">跳转</span>
                     <input class="text" type="text" value="">
                     <span class="msg">页</span>-->
            </div>
        </div>
    }
    <input type="hidden" class="js-nodeId" value="@ViewBag.Node.Id"/>
    <script src="/Themes/CoralAdmin/_misc/scripts/jquery.plugin.js"></script>
    <script src="/Themes/CoralAdmin/_misc/scripts/jquery.app.js"></script>
    <script src="/Themes/CoralAdmin/_misc/scripts/nodeRelation.js"></script>
    <script>
        $(function () {
            var $pDoc = $(window.parent.document);
            var $iframe = $pDoc.find("#nodeRelation");
            $iframe.height($("body").height());

        })
    </script>
</body>
